import React from 'react'

import TopBar from '../components/TopBar'
import Nav from '../components/Nav'
import Footer from '../components/Footer'
import Myaccount from '../components/Myaccount'
import Loginout from '../components/Loginout'
import DialogImg from '../components/DialogImg'

class Account extends React.Component{
    constructor(props){
        super(props);
        this.state ={
            dialog:"false",
            dialogImg:"false",
            imgSrc:""
        }
    }
    dialogShow(msg){//处理父组件和子组件的通信
        this.setState({
            dialog:msg
        });
    }
    dialogImgShow(msg,src){
        console.log(msg);
        console.log(src);
        this.setState({
            dialogImg:msg,
            imgSrc:src
        })
    }
    render(){
        return(
            <div>
                <TopBar/>
                <div className="account">
                    <Nav dialogShow = {msg => this.dialogShow(msg)}/>
                    <Myaccount isDialogImgShow = {(msg,src)=>this.dialogImgShow(msg,src)}/>
                </div>
                <Footer/>
                <Loginout dialog={this.state.dialog} isDialog = {msg => this.dialogShow(msg)}/>
                <DialogImg dialogimg = {this.state.dialogImg} dialogimgSrc={this.state.imgSrc} isDialogImgShow = {(msg,src)=>this.dialogImgShow(msg,src)}/>
            </div>
        )
    }
}

export default Account